//
//  NSTimer+ZGLBlock.m
//  ZeegingLottery
//
//  Created by 李曌 on 2018/11/7.
//  Copyright © 2018 蒂埃里. All rights reserved.
//

#import "NSTimer+ZGLBlock.h"

@implementation NSTimer (ZGLBlock)

+ (NSTimer*) zgl_scheduledTimerWithTimeInterval:(NSTimeInterval)interval
                                          block:(void(^)())block
                                        repeats:(BOOL)repeats
{
    return [self scheduledTimerWithTimeInterval:interval target:self selector:@selector(blockInvoke:) userInfo:[block copy] repeats:repeats];
    
}

+(void)blockInvoke:(NSTimer*)timer {
    void (^block)() = timer.userInfo;
    if (block) {
        block();
    }
}

@end
